package TwoDay.HomeWork;

import java.util.Scanner;

//1.循环输入大于0的数字进行累加，知道输入的数字为0，就结束循环，并输入最后累加的和
public class HomeWork1 {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int sum = 0;
        int x;
        do {
            System.out.println("请输入任意整数：");
            x = scanner.nextInt();
            if (x > 0) {
                sum+=x;
            }
        }while (x!=0);
        System.out.println("累加的结果sum="+sum);
    }
}
